package com.mgq.netty.c7;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class TestReflect {
    public static void main(String[] args) throws Exception {
        Class<?> hello = Class.forName("com.mgq.netty.c7.Hello");
        Constructor<?> declaredConstructor = hello.getDeclaredConstructor(String.class, int.class);
        Hello o = (Hello) declaredConstructor.newInstance("张三",23);
        Method method = hello.getMethod("test");
        method.invoke(o, null);
        Method test2 = hello.getMethod("test2", String.class);
        test2.invoke(o, "mgq");

    }
}
